﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Runda.EShop.Common.Entity;

namespace Runda.EShop.Web.UserControl
{
    public partial class OrderDetailAgent : OrderProductControl
    {
        public override string ProductCode
        {
            get {
                return ViewState["_ProductCode"].ToString();
            }
            set
            {
                ViewState["_ProductCode"] = value;
            }
        }

        private Guid ProductID
        {
            get
            {
                if (Request.QueryString["ProductID"] == null) return Guid.Empty;
                return new Guid(Request.QueryString["ProductID"]);
            }
        }

        public override List<BizShopCartEntity> ProductList
        {
            get
            {
                List<BizShopCartEntity> list = new List<BizShopCartEntity>(); 

                BizShopCartEntity entity = new BizShopCartEntity();
                entity.CustomerID = base.Page.User.Identity.LoginUser.UserID;
                entity.ProductID = ProductID;
                entity.ProductCode = ProductCode;
                entity.Quantity = txtQty.Value.Value;
                //经销商不能按批次效期订购
                //entity.BatchCode = ltlBatchCode.Text;
                //if (!string.IsNullOrEmpty(ltlDueDate.Text))
                //{
                //    entity.DueDate = Convert.ToDateTime(ltlDueDate.Text);
                //}
                //entity.Inventory = Convert.ToDecimal(txtInventory.Text);
                //entity.Remark = txtRemark.Text;
                entity.CreatedAt = DateTime.Now;
                entity.Deleted = false;

                list.Add(entity);
              
                return list;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.Load += new EventHandler(Page_Load);
        }
    }
}